<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ECSHOP 管理中心 - 编辑商品 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="${pageContext.request.contextPath}/Styles/general.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/Styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<h1>
    <span class="action-span"><a href="${pageContext.request.contextPath}/GoodsSel.do">商品列表</a>
    </span>
    <span class="action-span1"><a href="__GROUP__">ECSHOP 管理中心</a></span>
    <span id="search_id" class="action-span1"> - 编辑商品 </span>
    <div style="clear:both"></div>
</h1>

<div class="tab-div">
    <div id="tabbar-div">
        <p>
            <span class="tab-front" id="general-tab">通用信息</span>
        </p>
    </div>
    <div id="tabbody-div">
        <form  action="${pageContext.request.contextPath}/GoodsUpt.do" method="post" enctype="multipart/form-data">
        	<input type="hidden" name="g_id" value="${listgoods.get(0).getG_id() }"/>
            <table width="90%" id="general-table" align="center">
                <tr>
                    <td class="label">商品名称：</td>
                    <td><input type="text" name="g_name" size="30" value="${listgoods.get(0).getG_name() }"/>
                    <span class="require-field">*</span></td>
                </tr>
                <tr>
                    <td class="label">商品价格： </td>
                    <td>
                        <input type="text" name="price" value="${listgoods.get(0).getPrice() }" size="20"/>
                    </td>
                </tr>
                <tr>
                    <td class="label">商品数量：</td>
                    <td>
                        <input type="text" name="numbers" value="${listgoods.get(0).getNumbers() }" size="20"/>
                    </td>
                </tr>
                <tr>
                    <td class="label">商品分类：</td>
                    <td>
                        <select name="gc_id" id="gc_id">
                            <option value="0">请选择...</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="label">商品品牌：</td>
                    <td>
                        <select name="gb_id" id="gb_id">
                            <option value="0">请选择...</option>
                            
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="label">是否上架：</td>
                    <td>
                    <c:if test="${listgoods.get(0).getIs_on() }==1 || {listgoods.get(0).getIs_on() }==0">
                    	<c:set var="check" value="checked=\"checked\"" scope="page"></c:set>
                    </c:if>
                        <input type="radio" name="is_on" value="1" />是
                        <input type="radio" name="is_on" value="0" />否
                    </td>
                </tr>
                <tr>
                    <td class="label">是否推荐：</td>
                    <td>
                        <input type="radio" name="is_on_push" value="100" />是
                        <input type="radio" name="is_on_push" value="100" checked="checked"/>否
                    </td>
                </tr>
                    <td class="label">商品图片：</td>
                    <td>
                        <img src="${pageContext.request.contextPath}/upload/${listgoods.get(0).getG_pic()}"/><br />
                       	 新图片：<input type="file" name="g_pic"/>
                    </td>
                </tr>
                <tr>
                    <td class="label">商品简单描述：</td>
                    <td>
                        <textarea name="g_desc" cols="40" rows="3" >
                        	${listgoods.get(0).getG_desc() }
                        </textarea>
                    </td>
                </tr>
            </table>
            <div class="button-div">
                <input type="submit" value=" 确定 " class="button"/>
                <input type="reset" value=" 重置 " class="button" />
            </div>
        </form>
    </div>
</div>

<div id="footer">
共执行 9 个查询，用时 0.025161 秒，Gzip 已禁用，内存占用 3.258 MB<br />
版权所有 &copy; 2005-2012 上海商派网络科技有限公司，并保留所有权利。</div>
</body>
<script>
	$(function(){
		/*ajax获取商品的分类信息  */
		$.ajax({
			url:"${pageContext.request.contextPath}/AjaxGetCaterage.do",
			type:"post",
			dataType:"json",
			success:function(result,statue,xhr){
				/* console.log(result);
				console.log(statue);
				console.log(xhr); */
				$.each(result,function(index,item){
					$("#gc_id").append("<option value="+item.c_id+">"+item.c_name+"</option>");
				});
			}
		});
		/*ajax获取商品的品牌信息  */
		$.ajax({
			url:"${pageContext.request.contextPath}/AjaxGetBrand.do",
			type:"post",
			dataType:"json",
			success:function(result,statue,xhr){
				 console.log(result);
				console.log(statue);
				console.log(xhr); 
				 $.each(result,function(index,item){
					$("#gb_id").append("<option value="+item.b_id+">"+item.b_name+"</option>");
				}); 
			}
		});
		$("#gc_id").on("click",function(){/* ajax获取分类信息 */
			
			
		});
		
	})
</script>
</html>